/*添加用户组*/
'use strict';
const userGroupAddAction = require('../actions/adminUserManagement/userGroup/userGroupAddAction');
const userGroupUpdateAction = require('../actions/adminUserManagement/userGroup/userGroupUpdateAction');
const userGroupQueryAction = require('../actions/adminUserManagement/userGroup/userGroupQueryAction');
const userGroupDelAction = require('../actions/adminUserManagement/userGroup/userGroupDelAction');

module.exports = async function (ctx) {
    let param = ctx.method === 'GET' ? ctx.query : ctx.request.fields;
    let action_type = param.action_type;
    try {
        switch (action_type) {

            case 'userGroupAdd': //
                ctx.body = await userGroupAddAction(param);
                break;
            case 'userGroupUpdate': //
                ctx.body = await userGroupUpdateAction(param);
                break;
            case 'userGroupQuery': //
                ctx.body = await userGroupQueryAction(param);
                break;
            case 'userGroupDel': //
                ctx.body = await userGroupDelAction(param);
                break;
        }
    } catch (e) {
        ctx.body = {success: false, message: e.message};
    }

};